package beans;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import dto.CitizenDTO;
import entitymanagers.CitizenManager;




@ManagedBean(name = "register")
@RequestScoped
public class RegisterBean {
	
	@EJB
	private CitizenManager citMgr;
	private CitizenDTO citizen;
	
	public RegisterBean(){
		setCitizen(new CitizenDTO());
	}

	public CitizenDTO getCitizen() {
		return citizen;
	}

	public void setCitizen(CitizenDTO citizen) {
		this.citizen = citizen;
	}
	public String register(){
		citMgr.addCitizen(citizen);
		return "home?faces-redirect = true";
	}
	
}
